]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Move onto the correct page while DnD on both LTR/RTL
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 1 Mar 2021 17:13:02 +0000 (18:13 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 1 Mar 2021 17:34:46 +0000 (18:34 +0100)
Look up the next page correctly for the overshoot coordinates, given
the text direction. We don't need to look whether there is a next
page either, as goToPage() checks that it's the case.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3778
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1734>

js/ui/appDisplay.js

index dee7df3002aef5d8f06189aaf37dbd2398aa3066..c3958ae9ce83120b24c2dedcaa9618c11c8ba600 100644 (file)
@@ -475,13 +475,11 @@ var BaseAppView = GObject.registerClass({
         if (this._lastOvershoot >= 0)
             return;
 
-        const currentPosition = this._adjustment.value;
-        const maxPosition = this._adjustment.upper - this._adjustment.page_size;
-
-        if (dragPosition <= gridStart && currentPosition > 0)
-            this.goToPage(this._grid.currentPage - 1);
-        else if (dragPosition >= gridEnd && currentPosition < maxPosition)
-            this.goToPage(this._grid.currentPage + 1);
+        const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
+        if (dragPosition <= gridStart)
+            this.goToPage(this._grid.currentPage + (rtl ? 1 : -1));
+        else if (dragPosition >= gridEnd)
+            this.goToPage(this._grid.currentPage + (rtl ? -1 : 1));
         else
             return; // don't go beyond first/last page